package dao;

import java.sql.Connection;
import java.sql.DriverManager;

public abstract class ModelDAO {

	private String jdbcDriver;
	private String jdbcURL;
	private String username;
	private String password;
	private Connection connection;
	
	public ModelDAO(){
		jdbcDriver 	= "oracle.jdbc.OracleDriver";
		jdbcURL    	= "jdbc:oracle:thin:@201.214.90.157:1521:cc5604";		
		username    = "GRUPO02";
		password    = "password";
	}
	
	public Connection getConnection(){
		try {
			Class.forName(this.jdbcDriver);
			this.connection = DriverManager.getConnection(jdbcURL,this.username,this.password);
		}
		catch(Exception e){e.printStackTrace(System.out); System.exit(0);}
		
		return this.connection;
	}
	
	public void closeConnection(){
		try{
			this.connection.close();
		}
		catch(Exception e){e.printStackTrace();}
	}
	
}
